package com.igd.business.dao.impl;

import java.sql.SQLException;
import java.util.List;

import com.igd.business.dao.IResDao;
import com.igd.exceptions.IgdException;
import com.igd.pojo.vo.PageList;
import com.igd.security.Resources;

 /**
 * @version  1.0
 *
 * @author   QIAOYU
 *
 * @date     2013-7-5
 *
 * @description	 平台资源信息Dao接口实现类
 */

public class IResDaoImpl extends IBaseDaoImpl implements IResDao {

	private final String GET_RESOURCES_PAGELIST_SQL = "res.getResources";
	
	private final String GET_RESOURCES_COUNT_SQL = "res.getResourcesCount";
	
	private final String GET_RESOURCES_INFO_SQL = "res.getResourcesInfo";
	
	private final String DEL_RESOURCES_INFO_SQL = "res.delResource";
	
	private final String INSERT_RESOURCES_INFO_SQL = "res.insertResource";
	
	private final String UPDATE_RESOURCE_INFO_SQL = "res.updateResource";
	
	public List<Resources> queryAllRes(PageList pageList,Resources res) throws SQLException, IgdException {
		
		return this.queryForListPage(GET_RESOURCES_PAGELIST_SQL,GET_RESOURCES_COUNT_SQL, pageList, res);

	}

	public Resources queryResInfo(Resources res) throws SQLException, IgdException {
		
		return this.queryForObject(GET_RESOURCES_INFO_SQL,res);
	}

	public void deleteResources(Resources resources) throws SQLException, IgdException {
		
		this.delete(DEL_RESOURCES_INFO_SQL, resources);
	}

	public Resources insertResources(Resources resources) throws SQLException, IgdException {
		
		this.save(INSERT_RESOURCES_INFO_SQL,resources);
		
		return resources;
	}

	public void updResources(Resources resources) throws SQLException, IgdException {
		
		this.update(UPDATE_RESOURCE_INFO_SQL, resources);
	}
}
